package com.newlink.building.userinfo.mvp

import com.newlink.building.common_base.base.BasePresenter
import com.newlink.building.common_base.ext.ss
import com.newlink.building.common_base.model.bean.MessageReadRequest
import com.newlink.building.userinfo.mvp.contract.Module_UserInfo_MessageCenterDetailContract
import com.newlink.building.userinfo.mvp.model.Module_UserInfo_MessageCenterDetailModel

/**
 * @author wangyang
 * @date 2022/4/11
 * @description 我的——消息中心——消息详情页面的Presenter
 */
class Module_UserInfo_MessageCenterDetailPresenter :
    BasePresenter<Module_UserInfo_MessageCenterDetailContract.Model, Module_UserInfo_MessageCenterDetailContract.View>(),
    Module_UserInfo_MessageCenterDetailContract.Presenter {

    override fun createModel(): Module_UserInfo_MessageCenterDetailContract.Model? {
        return Module_UserInfo_MessageCenterDetailModel()
    }

    override fun setMessageReadStatus(request: MessageReadRequest) {
        mModel?.setMessageReadStatus(request)?.ss(mModel, mView) {
            if (it?.code == 200) {
                mView?.setMessageReadStatusSuccess()
            } else {
                mView?.setMessageReadStatusFail()
            }
        }
    }

}